package com.jzd1997.lesson1;

public abstract class Operation {
    // 数据A
    protected double operandA;
    // 数据B
    protected double operandB;
    // 操作符
    protected String operator;

    public double getOperandA() {
        return operandA;
    }

    public void setOperandA(double operandA) {
        this.operandA = operandA;
    }

    public double getOperandB() {
        return operandB;
    }

    public void setOperandB(double operandB) {
        this.operandB = operandB;
    }

    public String getOperator() {
        return operator;
    }

    public void setOperator(String operator) {
        this.operator = operator;
    }

    public Operation(){

    }

    abstract public double getResult();

    public void printResult() {
        System.out.printf("%.2f %s %.2f = %.2f",operandA,operator,operandB,getResult());
    }
}
